<template>
  <div>
    <a-steps :current="this.current">
      <a-step v-for="item in this.steps"
              :key="item.title"
              :title="item.title"
              @click="changeTo(item.id)"
      />
    </a-steps>
    <div class="steps-content">
      <!-- 不同步骤包含内容 -->
      <slot :name="this.stepNames[this.current]">
        {{ this.steps[this.current].content }}
      </slot>
    </div>
    <!-- 操作步骤条的按钮 -->
    <slot name="steps-action"></slot>
  </div>
</template>

<script>
  export default {
    name: "steps",
    props: ['steps', 'stepNames', 'current'],
    methods: {
      /*点击跳转到某步骤*/
      changeTo(id) {
        this.$emit('changeCurrent', id)
      }
    }
  }
</script>

<style scoped>
  .steps-content {
    padding-top: 0;
    margin-top: 16px;
    border: 1px dashed #e9e9e9;
    border-radius: 6px;
    min-height: 200px;
    text-align: center;
  }

  /deep/ .ant-steps-item-process .ant-steps-item-icon {
    background: #993333;
    border-color: #993333;
  }

  /deep/ .ant-steps-item-wait .ant-steps-item-icon {
    border-color: rgba(153, 51, 51, 0.54);
  }

  /deep/ .ant-steps-item-finish .ant-steps-item-icon {
    border-color: #993333;
  }

  /deep/ .ant-steps-item-finish > .ant-steps-item-content > .ant-steps-item-title::after {
    background-color: #993333;
  }

  /deep/ .ant-steps-item-finish .ant-steps-item-icon > .ant-steps-icon {
    color: #993333;
  }
</style>
